<?php

/*
Process Award Items (admin_give_item.pro.php)
*/

$rank_check = "7";
include "../global.inc.php";

$findItem = fetch("SELECT id,parts,item_name FROM items2 WHERE item_name = '$award_itemname' AND game = '$game'");
if (!$findItem[id])
{
die(header("Location: admin_give_item.php?game=$game&error=There+is+no+such+item+as+a+$award_itemname,+please+try+again."));
}
$award_to = strtolower(ereg_replace(" ", "", $award_to));
$findUser = fetch("SELECT id,display_name FROM members2 WHERE username = '$award_to' AND game = '$game'");
if (!$findUser[id])
{
die(header("Location: admin_give_item.php?game=$game&error=There+is+no+such+user+as+a+$award_to,+please+try+again."));
}

mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$findUser[id]','$findItem[id]','$findItem[parts]','$game')");

$errorMessage = "You+have+given+$findUser[display_name]+a+$findItem[item_name]!";

systemmessage("$game", "myitems.php?game=$game", "$findUser[id]", "An admin has given you a $findItem[item_name]!");

header("Location: admin_give_item.php?game=$game&error=$errorMessage");

?>
